package com.siam.package_rider.controller.admin;

import com.siam.package_common.entity.BasicResult;
import com.siam.package_merchant.model.param.MerchantBillingRecordParam;
import com.siam.package_rider.model.param.TbRiderBillParam;
import com.siam.package_rider.service.TbRiderBillService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * ---------------------------
 * 骑手账单表 (TbRiderBillController)         
 * ---------------------------
 * 作者：  高品
 * 时间：  2025-03-29 18:55:18
 * ---------------------------
 */
@RestController
@RequestMapping("/rest/admin/riderBill")
public class AdminRiderBillController {

	@Autowired
	private TbRiderBillService tbRiderBillService;

	/**
	 * 保存骑手账单表
	 * @param param
	 * @return
	 */	
	@PostMapping(value="/insert")
	public BasicResult insert(@RequestBody TbRiderBillParam param) {
		tbRiderBillService.insert(param);
		return BasicResult.success();
	}

    /**
     * 删除骑手账单表
     * @param id
     * @return
     */
	@PostMapping(value="/delete")
	public BasicResult delete(@RequestParam Long id) {
		tbRiderBillService.delete(id);
		return BasicResult.success();
	}

    /**
     * 批量删除骑手账单表
     * @param idList
     * @return
     */
	@PostMapping(value="/batchDelete")
	public BasicResult batchDelete(@RequestBody List<Long> idList) {
		tbRiderBillService.batchDelete(idList);
		return BasicResult.success();
	}

	/**
	 * 修改骑手账单表
	 * @param param
	 * @return
	 */
	@PostMapping(value="/update")
	public BasicResult update(@RequestBody TbRiderBillParam param) {
		tbRiderBillService.update(param);
		return BasicResult.success();
	}

    /**
     * 基础分页查询
     * @param param
     * @return
     */    
	@PostMapping(value="/page")
	public BasicResult page(@RequestBody TbRiderBillParam param) {
		return BasicResult.success(tbRiderBillService.page(param));
	}
	
    /**
     * 根据主键查询
     * @param id
     * @return
     */ 	
	@PostMapping(value="/findById")
	public BasicResult findById(@RequestParam Long id) {
		return BasicResult.success(tbRiderBillService.findById(id));
	}

	@ApiOperation(value = "商家账单记录-统计金额")
	@PostMapping(value = "/statisticalAmount")
	public BasicResult statisticalAmount(@RequestBody @Validated(value = {}) TbRiderBillParam param) {
		Map<String, Object> map = tbRiderBillService.statisticalAmount(param);
		return BasicResult.success(map);
	}
}
